Stacks is a an abstract data type and data structure based on the principle of Last In First Out. Stacks is build of by arraylists.
To create a stack: Stack name = new Stack();
there are several method that is important when study stacks:
boolean isEmpty() return true if the stack have no object in it
void push( Object obj) add obj to the top of the stack;
Object Pop() remove the object on top from the stack;
Object peekTop() return the object on top, but doesn't remove it from the stack.
To create a stack: Stack name = new Stack();
there are several method that is important when study stacks:
boolean isEmpty() return true if the stack have no object in it
void push( Object obj) add obj to the top of the stack;
Object Pop() remove the object on top from the stack;
Object peekTop() return the object on top, but doesn't remove it from the stack.